using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SkeleMoveState : SkeleGroundState
{
    public SkeleMoveState(SkeleEnemy skele, StateMachine stateMachine, string animName) : base(skele, stateMachine, animName)
    {
    }

    public override void Enter()
    {
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();


        skele.SetVelocity(skele.moveSpeed * skele.facingDir, rb.velocity.y);

        if (!skele.IsGroundDetected() || skele.IsWallDetected())
        {
            skele.Flip();
            stateMachine.ChangeState(skele.idleState);
        }

        
    }
}
